<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
	a{ text-decoration: none; }
	a:link { color: blue }               /* 未被访问的链接 */
	a:visited { color: blue }            /* 已被访问过的链接 */ 
</style>
</head>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.4.4.min.js"></script>
<script language=javascript>
	function delOne(userId){
		var sure = window.confirm("确定删除吗？");
		if(sure){
			if(userId == 0 || userId == 1){
				alert("公海/管理员 账户无法删除！");				
				return false;
			} else {
				window.location.href="${pageContext.request.contextPath}/user/removeUser.action?userId="+userId;				
			}
		}
	};
 	function edit(userId){
		if(userId == 0){
			alert("公海 账户无法修改！");
		}
	};
</script>
<body>
	<h2>员工列表</h2>
	<s:form action="findAllUser" namespace="/user">
		<table>
		<TBODY>
		<tr>
			<td>
				<table>
				<tr style="FONT-WEIGHT: bold; FONT-STYLE: normal; BACKGROUND-COLOR: #eeeeee; TEXT-DECORATION: none">
					<!-- <td>职工ID</td> -->
					<td>职工姓名</td>
					<td>学生数量</td>
					<td>操作</td>
				</tr>
				<s:iterator value="users" var="u">
					<tr>
					<!-- <tr style="FONT-WEIGHT: normal; FONT-STYLE: normal; BACKGROUND-COLOR: white; TEXT-DECORATION: none">-->					
						<%-- <td>${userId }</td> --%>
						<td>${userName }</td>
						<td>${studentNum }</td>
						
						<td>
							<s:a action="editUIUser" namespace="/user" onclick="edit(%{userId })">
							<s:param name="userId" value="%{userId}" ></s:param>
								修改
							</s:a>
							<%-- <a href="${pageContext.request.contextPath}/user/editUIUser?userId=${u.userId}" >
									修改
							</a> --%>
							&nbsp;&nbsp;
							<s:a href="javascript:delOne('%{userId}')">删除</s:a>
						</td>
					</tr>
				</s:iterator>
				</table>
			</td>
		</tr>
		</TBODY>
		</table>
		
	</s:form>
	<br><br><br>
	<s:a action="addUIUser" namespace="/user">
			添加职工
	</s:a>
</body>
</html>